import gradio as gr
from core.LLM_API import *
from core.LLM_API import get_dir_list
from core.LLM_API import get_dir_list_str
from core.LLM_API import get_mind_chat
from core.LLM_API import get_mind_chat_steam

llm = GLM_LLMS()


with gr.Blocks() as app:
    chat_interface = gr.ChatInterface(
        fn=get_mind_chat,
        chatbot=gr.Chatbot(
            sanitize_html=False,
            type="messages",
            height=500,  # 设置固定高度
            rtl=False,  # 确保从左到右渲染
            # avatar_images=["\U0001F60A", "\U0001F916"]  # 使用简单头像
        ),
        type="messages",
        title="Qwen4模型",
        description="与Qwen4模型对话",
        submit_btn="提交",
        stop_btn="撤销",
        api_name="get_mind_chat"
    )
    chat_interface_steam = gr.ChatInterface(
        fn=get_mind_chat_steam,
        chatbot=gr.Chatbot(
            sanitize_html=False,
            type="messages",
            height=500,  # 设置固定高度
            rtl=False,  # 确保从左到右渲染
            # avatar_images=["\U0001F60A", "\U0001F916"]  # 使用简单头像
        ),
        type="messages",
        title="Qwen4模型",
        description="与Qwen4模型流式对话",
        submit_btn="提交",
        stop_btn="撤销",
        api_name="get_mind_chat_steam"
    )



if __name__ == '__main__':
    app.launch()
